using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.GamerServices;

namespace Elementum
{
    class PrepareStage : Stage
    {
        Image _openImage2;
        Image _openImage1;
        int tempCount = 0;

        public PrepareStage(Game game)
            : base(game)
        {
        }

        public override void InitializeScenes()
        {
            _lockTouch = false;
            camera = new Camera2D(this.Game);
            Animation open1 = new Animation("images/system/black", new Point(800, 480));
            Image openImage1 = new Image(open1);
            openImage1.Position = new Vector2(400, 240);

            _controls.Add(openImage1);

            Guide.BeginShowMessageBox("Elementum - Alert", "Would you want to pasue the music while playing this game ?",
                                        new List<string> { "Yes", "No" }, 1, MessageBoxIcon.None,
                                        new AsyncCallback(OnXNAMessageClose), null);
           
            //MediaPlayer.Play(_song);
            //MediaPlayer.IsRepeating = true;
            //MediaPlayer.Volume = 0.4f;
        }

        private void OnXNAMessageClose(IAsyncResult aRes)
        {
            GameClass game1 = (GameClass)this.Game;
            switch (Guide.EndShowMessageBox(aRes))
            {
                case 0: //Star Trek
                    
                    break;
                case 1: //Star Wars
                    GameClass.IsExit = true;
                    break;
                default: 
                    GameClass.IsExit = true;
                    break;
            }
            game1.CurrentStage = (new OPeningStage(game1)).Clone();
        }

        public override void Update(int delta)
        {
            base.Update(delta);
            TouchCollection TouchPoints = TouchPanel.GetState();
            TouchLocationState state = TouchLocationState.Invalid;
            foreach (TouchLocation touchPointEvent in TouchPoints)
            {
                state = touchPointEvent.State;
                if (state == TouchLocationState.Moved) {
                   
                }
            }
        }

        public override void PressedBackButton()
        {
           // base.MenuState();
            GameClass.IsExit = true;
        }

        public override Stage Clone()
        {
            PrepareStage stage = new PrepareStage(Game);
            stage.InitializeScenes();
            return stage;
        }
    }
}
